<?php

use think\migration\Seeder;
use app\admin\model\ReceiveAddressModel;
use think\Db;

class TeamSeeder extends Seeder
{

    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run()
    {
        for ($i = 0; $i <= 50; $i++) {
            $address = new \app\admin\model\TeamModel();
            $address->save($this->faker());
        }

    }

    public function faker()
    {

        $faker = Faker\Factory::create('zh_CN');
        $avatars = [
            'admin/20200513/c325435609dfee2ee421c75e59dc43f5.jpg',
            'admin/20200513/c325435609dfee2ee421c75e59dc43f5.jpg',
            'admin/20200513/c325435609dfee2ee421c75e59dc43f5.jpg',
            'admin/20200513/c325435609dfee2ee421c75e59dc43f5.jpg',
            'admin/20200513/6005c93e482e4631ce732ee425d9667c.jpg',
        ];

        $type = mt_rand(0, 2);
        $name = ['上海队', '河南队', '天津队', '北京队', '河北队', '山东队', '广东队', '广西队', '海南队', '云南队'];
        return [
            //随机获取一个用户
            'type'      => $type,
            'team_name' => $faker->randomElement($name),
            'logo'      => $faker->randomElement($avatars),

        ];
    }
}